IF (DOXYGEN_FOUND)
	EXECUTE_PROCESS(
		WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
		# COMMAND bzr nick
		# This will get the current branch name; I think that is what is wanted?
		COMMAND git rev-parse --abbrev-ref HEAD
		OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE)
	EXECUTE_PROCESS(
		WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
		COMMAND git log -1 --pretty="%h"
		OUTPUT_VARIABLE GIT_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
	CONFIGURE_FILE(
		${PROJECT_SOURCE_DIR}/doc/Doxyfile
		${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
	ADD_CUSTOM_TARGET (
		doxygen
		COMMAND ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
		COMMENT "Generating documentation"
	)
    IF (STACK_FOUND)
        ADD_DEPENDENCIES(doxygen haskell-doc)
    ENDIF (STACK_FOUND)
    ADD_CUSTOM_TARGET(haskell-doc
        COMMAND ${CMAKE_COMMAND} -DBINDIR=${CMAKE_BINARY_DIR}
                                 -DSRCDIR=${CMAKE_SOURCE_DIR}
                                 -P HaskellDoc.cmake
        DEPENDS haskell-atomspace-lib
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        COMMENT "Generating haskell library documentation..."
    )
ELSE (DOXYGEN_FOUND)
    MESSAGE(STATUS "Doxygen not found, you won't be able to generate API documentation.")
ENDIF (DOXYGEN_FOUND)
